package com.duowan.mspider.util;

/**
 * @author:wangyan1
 * @create_time: 2018-04-10 22:04
 */

public class Constant {

	public enum SearchEngine{
		Baidu("https://m.baidu.com/s?word=", "//div[@data-lp]/@data-lp", true),
		//Baidu2("https://m.baidu.com/s?pn=10&word=", "//div[@data-lp]/@data-lp"),
		//Baidu3("https://m.baidu.com/s?pn=20&word=", "//div[@data-lp]/@data-lp"),
		//BaiduPc("https://baidu.com/s?word=", "//a[@data-landurl]/@data-landurl"),

		Sm("https://m.sm.cn/s?q=", "//*[@id=\"results\"]/*/a/@data-url", false),//需要通过chrome
		Sogou("https://m.sogou.com/web/searchList.jsp?keyword=", "//*[@id]/div/h3/a[@class=\"bizResultLink\"]/@href", true),
		//So("https://m.so.com/s?q=", "//*[@id]/a/@e_href", false), //有针对ip的验证码，可以放弃
		;
		public String url;
		public String xpath;
		public boolean valid;

		SearchEngine(String url, String xpath, boolean valid) {
			this.url = url;
			this.xpath = xpath;
			this.valid = valid;
		}
	}

	public enum KeyWordsFile{
		Chuanqi("传奇.txt", "传奇_result.txt"),
		//Xianxia("仙侠.txt", "仙侠_result.txt"),
		//MD("梦道.txt", "梦道_result.txt"),
		;

		public String srcFileName;
		public String destFileName;

		KeyWordsFile(String srcFileName, String destFileName) {
			this.srcFileName = srcFileName;
			this.destFileName = destFileName;
		}

		public String getTempFile(){
			return srcFileName + ".tmp";
		}

		public String getSmTempFile(){
			return srcFileName + ".sm.tmp";
		}
	}

	public enum HtmlSite{
		//site3("http://kf.87pk.com/ajax.php?op=show&page=0", "//a[@class=\"star_game2\"]/@href"),
		//site4("http://kf.87pk.com/ajax.php?op=show&page=1", "//a[@class=\"star_game2\"]/@href"),
		//site5("http://www.12pk.com", "//a[@class=\"jinru02-button ico\"]/@href", true),
		//site6("http://www.shuangzan.com/OPenServices/ServiceIndex", "//a[@class=\"start\"]/@href", false, true),
		//site7("http://kf.6k9k.com", "//a[@class=\"vGo2\"]/@href", true),
		//site8("https://www.30309.com/", "//a[@class=\"operation\"]/@href", false),
		//site9("https://kf.40407.com/", "//a[@class=\"kuai_kaifua\"]/@href", true),
		//site10("https://www.taoyeyou.com/", "//a[@class=\"operation\"]", false),//json
		//site11("http://kf.9u8u.com/", "//a[@rel=\"nofollow\"]/@href", false),
		//site12("http://kf.4yx.com/", "//td[@class=\"xplay\"]/a/@href", true),
		//site13("http://kf.17566.com/", "//a[@class=\"game-start\"]/@href", false),
		//site14("https://kf.265g.com/", "//a[@rel=\"nofollow\"]/@href", false),
		//site15("https://kf.07073.com/?f=zn1", "//a[@class=\"vGo2\"]/@href", false),
		//site16("http://kf.414game.com", "//a[@class=\"vStart\"]/@href", true),
		//site17("http://web.ali213.net/kaifu.html", "//a[@class=\"kaifu_a\"]/@onclick", false),
		//site18("https://kf.eeyy.com/", "//a[@class=\"pgame f08\"]/@href", false),
		//site19("https://kf.9k9k.com/", "//a[@rel=\"nofollow\"]/@href", false),
		//site20("http://game.5217yx.com/kaifu", "//tr[@class=\"on\"]/td[7]/a[1]/@href", false),
		//site21("https://www.kaiqubiao.com/", "//a[@class=\"start\"]", false),//json
		//site22("http://www.yukaifu.com/", "//a[@class=\"start\"]/@href", false),
		//site23("http://www.5336.com", "//a[@rel=\"nofollow\"]/@href", true),
		//site24("http://www.jiekaifu.com/", "//a[@class=\"start\"]/@href", false),
		//site25("http://kf.1177k.com", "//a[@class=\"vGo2 goPlayBtn\"]/@href", true),
		
		//site26("http://ggb.o0pk.com", "//dd[@class=\"c7\"]/a/@href", false),
		//site27("http://www.wx316.com/Index.asp", "//dl/dt[@class=\"xx\"]/a/@href", false), //所有连接写入js中，Chrome插件无法加载页面
		//site28("http://www.nocn.com.cn/", "//tr/td[7]/a/@href", false),//网站异常，无法打开
		site29("http://yyy.wd258.com/", "//tr/td[7]/a/@href", false),//http://www.ls668.com/
		//site30("http://www.gree100.com/", "//tr/td[7]/a/@href", false),//网站异常，无法打开
		//site31("http://www.zzljrj.com/", "//tr/td[7]/a/@href", false),//用iframe加载site29，重复内容不需要爬取
		//site32("http://www2.58sf.com/", "//dd[@class=\"c7\"]/a/@href", false),//网站异常，无法打开
		//site33("http://www.ly45.net/", "//tr/td[7]/a/@href", false),//http://lieyanyx.com/
		//site34("http://9tss.com/kaifubiao/kaifubiao.html", "//tr/td[6]/a/@href", false),//http://www.dudu45.com/
		//site35("http://yrmuyi.com/", "//tr/td[6]/a/@href", false),//网站异常，无法打开
		//site36("http://www.6fsd.com/", "//dd[@class=\"c7\"]/a/@href", false),
		//site37("http://183.60.111.105:5173/", "//dl/dt[@class=\"xx\"]/a/@href", false), //所有连接写入js中，Chrome插件无法加载页面
		;
		public String url;
		public String xpath;
		public boolean isRelativePath;

		HtmlSite(String url, String xpath) {
			this.url = url;
			this.xpath = xpath;
			this.isRelativePath = false;
		}

		HtmlSite(String url, String xpath, boolean isRelativePath) {
			this.url = url;
			this.xpath = xpath;
			this.isRelativePath = isRelativePath;
		}

		public String getSiteFileName(){
			return HTML_DIR + "/" + this.name() + ".txt";
		}
	}

	public static final String HTML_DIR = "htmlsiteresult";

	public static final String HTML_RESULT= HTML_DIR + ".txt" ;

	public enum JsonSite{
		site1("https://www.taoyeyou.com/", "regist_url"),
		;

		public String url;
		public String nodeName;

		JsonSite(String url, String nodeName) {
			this.url = url;
			this.nodeName = nodeName;
		}
	}
}
